{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set menu = 'admin_setting_mobile_settings' %}

{% set script_controller = 'setting/mobile' %}


{% block main %}
<style>
#mobile-splash1-container img ,
#mobile-splash2-container img ,
#mobile-splash3-container img ,
#mobile-splash4-container img ,
#mobile-splash5-container img ,
#mobile-logo-container img ,
#site-appcover-container img,
#site-applogo-container img
{max-width: 80%; margin-bottom: 10px;}
</style>

{{ web_macro.flash_messages() }}

<form class="form-horizontal" id="mobile-form" method="post">

  <div class="form-group">
    <div class="col-md-2 control-label">
      <label >{{'是否开启客户端'|trans}}</label>
    </div>
    <div class="controls col-md-8 radios">
      {{ radios('enabled', {1:'开启'|trans, 0:'关闭'|trans}, mobile.enabled) }}
      <div class="help-block">1.开启后，可将<a target="_blank" href="{{ path('mobile') }}">移动端首页</a>（域名/mobile）地址添加到网站顶部导航中</div>
      <div class="help-block">2.移动端轮播图、发现页模块等内容，点击<a target="_blank" href="{{ path('admin_operation_mobile') }}">这里</a>进行设置</div>
    </div>
  </div>
  
  <div class="form-group">
    <div class="col-md-2 control-label">
      <label for="mobile_about">{{'网校简介'|trans}}</label>
    </div>
    <div class="controls col-md-8">
      <textarea class="form-control" id="mobile_about" rows="10" name="about" data-image-upload-url="{{ path('editor_upload', {token:upload_token('default')}) }}">{{ mobile.about }}</textarea>
      <div class="help-block">{{'此简介将显示在移动客户端的"关于网校'|trans}}"</div>
    </div>
  </div>

  <div class="form-group">
    <div class="col-md-2 control-label">
      <label for="logo">{{'网校LOGO'|trans}}</label>
    </div>
    <div class="col-md-8 controls">
      <div id="mobile-logo-container">{% if mobile.logo %}<img src="{{ asset(mobile.logo) }}">{% endif %}</div>
      <a class="btn btn-default btn-sm" id="mobile-logo-upload" data-upload-token="{{ upload_token('system', 'image') }}" data-goto-url="{{ path('admin_setting_mobile_picture_upload', {type:'logo'}) }}">{{'上传'|trans}}</a>
      <button class="btn btn-default btn-sm" id="mobile-logo-remove" type="button" data-url="{{ path('admin_setting_mobile_picture_remove', {type:'logo'}) }}" {% if not mobile.logo %}style="display:none;"{% endif %}>{{'删除'|trans}}</button>
      <p class="help-block">{{'请上传png, gif, jpg格式的图片文件。LOGO图片的高度建议不要超过50px。'|trans}}</p>
      <input type="hidden" name="logo" value="{{ mobile.logo }}">
    </div>
  </div>

  <div class="form-group">
    <div class="col-md-2 control-label">
      <label for="logo">{{'公告'|trans}}</label>
    </div>
    <div class="col-md-8 controls">
      <input type="text" class="form-control" name="notice" value="{{ mobile.notice }}">
      <p class="help-block">{{'将会在手机端banner下面显示网校的公告，建议用简练概括的语言描述，字数在20字以下。'|trans}}</p>
    </div>
  </div>

{% if mobileCode != 'edusoho' and mobileCode != 'edusohov3' %}
  <fieldset>
    <legend>{{'定制APP设置项'|trans}}</legend>
      <div class="form-group">
        <div class="col-md-2 control-label">
          <label for="appname">{{'APP名称'|trans}}</label>
        </div>
        <div class="col-md-8 controls">
        <input type="text" class="form-control" name="appname" value="{{mobile.appname}}" >
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-2 control-label">
          <label for="appabout">{{'APP简介'|trans}}</label>
        </div>
        <div class="col-md-8 controls">
        <input type="text" class="form-control" name="appabout" value="{{mobile.appabout}}">
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-2 control-label">
          <label for="applogo">{{'APP图标'|trans}}</label>
        </div>
        <div class="col-md-8 controls">

         <div id="site-applogo-container" class="mbl">{% if mobile.applogo %}<img src="{{ asset(mobile.applogo) }}">{% endif %}</div>
          <a class="btn btn-default btn-sm" id="site-applogo-upload" data-upload-token="{{ upload_token('system', 'image') }}"
          data-goto-url="{{ path('admin_setting_mobile_picture_upload', {type:'applogo'}) }}">{{'上传'|trans}}</a>
          <button class="btn btn-default btn-sm" id="site-applogo-remove" type="button"
          data-url="{{ path('admin_setting_mobile_picture_remove', {type:'applogo'}) }}" {% if not mobile.applogo %}style="display:none;"{% endif %}>{{'删除'|trans}}</button>
          <p class="help-block">{{'请上传png, gif, jpg格式的图片文件。推荐尺寸 120*120。'|trans}}</p>
           <input type="hidden" name="applogo" value="{{ mobile.applogo }}">
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-2 control-label">
          <label for="appcover">{{'APP封面'|trans}}</label>
        </div>
        <div class="col-md-8 controls">
         <div id="site-appcover-container" class="mbl">{% if mobile.appcover %}<img src="{{ asset(mobile.appcover) }}">{% endif %}</div>
          <a class="btn btn-default btn-sm" id="site-appcover-upload" data-upload-token="{{ upload_token('system', 'image') }}"
          data-goto-url="{{ path('admin_setting_mobile_picture_upload', {type:'appcover'}) }}">{{'上传'|trans}}</a>
          <button class="btn btn-default btn-sm" id="site-appcover-remove" type="button"
          data-url="{{ path('admin_setting_mobile_picture_remove', {type:'appcover'}) }}" {% if not mobile.appcover %}style="display:none;"{% endif %}>{{'删除'|trans}}</button>
          <p class="help-block">{{'请上传png, gif, jpg格式的图片文件。推荐尺寸 225*400。'|trans}}</p>
          <input type="hidden" name="appcover" value="{{ mobile.appcover }}">
        </div>

      </div>
  </fieldset>
{% endif %}

 <fieldset>
  <legend>{{'设置启动图'|trans}}</legend>
  <div class="help-block">{{'最多允许设置5张启动图(尺寸为640*960)，用户首次登录网校时会显示启动图。'|trans}}</div>
  <div class="form-group">
    <div class="col-md-2 control-label">
      <label for="splash1">{{'启动图1'|trans}}</label>
    </div>
    <div class="col-md-8 controls">
      <div id="mobile-splash1-container">{% if mobile.splash1 %}<img src="{{ asset(mobile.splash1) }}">{% endif %}</div>
      <a class="btn btn-default btn-sm" id="mobile-splash1-upload" data-upload-token="{{ upload_token('system', 'image') }}"data-goto-url="{{ path('admin_setting_mobile_picture_upload', {type:'splash1'}) }}">{{'上传'|trans}}</a>
      <button class="btn btn-default btn-sm" id="mobile-splash1-remove" type="button" data-url="{{ path('admin_setting_mobile_picture_remove', {type:'splash1'}) }}" {% if not mobile.splash1 %}style="display:none;"{% endif %}>{{'删除'|trans}}</button>
      <p class="help-block">{{'请上传png, gif, jpg格式的图片文件'|trans}}。</p>
      <input type="hidden" name="splash1" value="{{ mobile.splash1 }}">
    </div>
  </div>

  <div class="form-group">
    <div class="col-md-2 control-label">
      <label for="splash2">{{'启动图2'|trans}}</label>
    </div>
    <div class="col-md-8 controls">
      <div id="mobile-splash2-container">{% if mobile.splash2 %}<img src="{{ asset(mobile.splash2) }}">{% endif %}</div>
      <a class="btn btn-default btn-sm" id="mobile-splash2-upload" data-upload-token="{{ upload_token('system', 'image') }}" data-goto-url="{{ path('admin_setting_mobile_picture_upload', {type:'splash2'}) }}">{{'上传'|trans}}</a>
      <button class="btn btn-default btn-sm" id="mobile-splash2-remove" type="button" data-url="{{ path('admin_setting_mobile_picture_remove', {type:'splash2'}) }}" {% if not mobile.splash2 %}style="display:none;"{% endif %}>{{'删除'|trans}}</button>
      <p class="help-block">{{'请上传png, gif, jpg格式的图片文件。'|trans}}</p>
      <input type="hidden" name="splash2" value="{{ mobile.splash2 }}">
    </div>
  </div>

  <div class="form-group">
    <div class="col-md-2 control-label">
      <label for="splash3">{{'启动图3'|trans}}</label>
    </div>
    <div class="col-md-8 controls">
      <div id="mobile-splash3-container">{% if mobile.splash3 %}<img src="{{ asset(mobile.splash3) }}">{% endif %}</div>
      <a class="btn btn-default btn-sm" id="mobile-splash3-upload" data-upload-token="{{ upload_token('system', 'image') }}" data-goto-url="{{ path('admin_setting_mobile_picture_upload', {type:'splash3'}) }}">{{'上传'|trans}}</a>
      <button class="btn btn-default btn-sm" id="mobile-splash3-remove" type="button" data-url="{{ path('admin_setting_mobile_picture_remove', {type:'splash3'}) }}" {% if not mobile.splash3 %}style="display:none;"{% endif %}>{{'删除'|trans}}</button>
      <p class="help-block">{{'请上传png, gif, jpg格式的图片文件。'|trans}}</p>
      <input type="hidden" name="splash3" value="{{ mobile.splash3 }}">
    </div>
  </div>

  <div class="form-group">
    <div class="col-md-2 control-label">
      <label for="splash4">{{'启动图4'|trans}}</label>
    </div>
    <div class="col-md-8 controls">
      <div id="mobile-splash4-container">{% if mobile.splash4 %}<img src="{{ asset(mobile.splash4) }}">{% endif %}</div>
      <a class="btn btn-default btn-sm" id="mobile-splash4-upload" data-upload-token="{{ upload_token('system', 'image') }}" data-goto-url="{{ path('admin_setting_mobile_picture_upload', {type:'splash4'}) }}">{{'上传'|trans}}</a>
      <button class="btn btn-default btn-sm" id="mobile-splash4-remove" type="button" data-url="{{ path('admin_setting_mobile_picture_remove', {type:'splash4'}) }}" {% if not mobile.splash4 %}style="display:none;"{% endif %}>{{'删除'|trans}}</button>
      <p class="help-block">{{'请上传png, gif, jpg格式的图片文件。'|trans}}</p>
      <input type="hidden" name="splash4" value="{{ mobile.splash4 }}">
    </div>
  </div>

  <div class="form-group">
    <div class="col-md-2 control-label">
      <label for="splash5">{{'启动图5'|trans}}</label>
    </div>
    <div class="col-md-8 controls">
      <div id="mobile-splash5-container">{% if mobile.splash5 %}<img src="{{ asset(mobile.splash5) }}">{% endif %}</div>
      <a class="btn btn-default btn-sm" id="mobile-splash5-upload" data-upload-token="{{ upload_token('system', 'image') }}" data-goto-url="{{ path('admin_setting_mobile_picture_upload', {type:'splash5'}) }}">{{'上传'|trans}}</a>
      <button class="btn btn-default btn-sm" id="mobile-splash5-remove" type="button" data-url="{{ path('admin_setting_mobile_picture_remove', {type:'splash5'}) }}" {% if not mobile.splash5 %}style="display:none;"{% endif %}>{{'删除'|trans}}</button>
      <p class="help-block">{{'请上传png, gif, jpg格式的图片文件。'|trans}}</p>
      <input type="hidden" name="splash5" value="{{ mobile.splash5 }}">
    </div>
  </div>

  </fieldset>



  <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
  
  <div class="row form-group">
    <div class="controls col-md-offset-2 col-md-8">
      <button type="submit" class="btn btn-primary">{{'提交'|trans}}</button>
    </div>
  </div>

</form>
{% endblock %}